package com.bawei.a2209_mianshi.ui.login.viewmodel

import com.bawei.a2209_mianshi.base.BaseViewModel
import com.bawei.a2209_mianshi.ui.login.repository.LoginRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import javax.inject.Inject

/**
 * @author yaotianxue
 * @description
 * @date 2025/5/13
 */
@HiltViewModel
class LoginViewModel @Inject constructor(private val repository: LoginRepository):BaseViewModel() {

    val phone: MutableStateFlow<String> = MutableStateFlow("123")
    val password: MutableStateFlow<String> = MutableStateFlow("")

    //保存当前正在显示的fragment
    private val _currentFragment = MutableStateFlow("")
    val currentFragment: StateFlow<String>
        get() = _currentFragment

    fun setShowingFragmentTag(tag: String) {
        _currentFragment.value = tag
    }

    fun clearPhone() {
        phone.value = ""
    }

    fun clearPassword() {
        password.value = ""
    }
}